<?php
/**
 * 生成静态-重新生成所有新闻详细信息
 * @final
 */
class Staticizer_Apps_Tool_News_Content_All extends Staticizer
{
    public function Build($param=NULL)
    {
        #获取内容静态化类
        $staticizer=new Staticizer_News_Content();

        #获取所有数据
        $data=DB::GetRows('select * from news order by ID asc');

        #逐条生成
        foreach($data as $row)
        {
            $data_temp=$staticizer->Execute($row);                                          //它们重新生成自己并计算与自己相关的记录
            if($row['M_HTMLFile'])                                                          //如果他们己经生成了，我们只是重新生成
            {
                $this->Save('news/'.$row['M_HTMLFile'],$data_temp['HTMLFile_Content']);     //保留自己
                DB::UpdateRowByID('news',$row['ID'],array                                   //更新与自己相关的记录
                (
                    'M_HTMLFile_Related'=>$data_temp['ID_Related']
                ));
            }
        }
    }
}
?>
